


#ifndef PF_UNDOABLE_H
#define PF_UNDOABLE_H

#include "pf_flags.h"
#include "lx_Export.h"

class PF_UndoCycle;



/**
 * Base class for something that can be added and deleted and every 
 * addition and deletion can be undone.
 *
 * @see PF_Undo

 */
class LX_EXPORT PF_Undoable : public PF_Flags {
public:
    PF_Undoable();
    virtual ~PF_Undoable();

    /**
     * Runtime type identification for undoables.
     * Note that this is voluntarily. The default implementation 
     * returns LX_Define::UndoableUnknown.
     */
    virtual LX_Define::UndoableType undoRtti() {
        return LX_Define::UndoableUnknown;
    }

    virtual void setUndoCycle(PF_UndoCycle* cycle);
    virtual void changeUndoState();
    virtual void setUndoState(bool undone);
    virtual bool isUndone() const;

	/**
	 * Can be overwriten by the implementing class to be notified
	 * when the undo state changes (the undoable becomes visible / invisible).
	 */
	virtual void undoStateChanged(bool /*undone*/) {}

    //friend std::ostream& operator << (std::ostream& os, PF_Undoable& a);

private:
    PF_UndoCycle* cycle;
};

#endif
